<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>nohup</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_001_014_1574">&nbsp;</a>NAME</h4><blockquote>
nohup - invoke a utility immune to hangups
</blockquote><h4><a name = "tag_001_014_1575">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

nohup <i>utility </i><b>[</b><i>argument</i>...<b>]</b>
</code>
</pre>
</blockquote><h4><a name = "tag_001_014_1576">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>nohup</i>
utility
will invoke the utility named by the
<i>utility</i>
operand with arguments supplied as the
<i>argument</i>
operands.
At the time the named
<i>utility</i>
is invoked,
the SIGHUP signal is set to be ignored.
<p>
If the standard output is a terminal,
all output written by the named
<i>utility</i>
to its standard output
will be appended to the end of the file
<b>nohup.out</b>
in the current directory.
If
<b>nohup.out</b>
cannot be created or opened for appending, the
output will be appended to the end of the file
<b>nohup.out</b>
in the directory specified by the
<i>HOME</i>
environment variable.
If neither file can be created or opened for appending,
<i>utility</i>
will not be invoked.
If a file is created, the file's
permission bits will be set to S_IRUSR | S_IWUSR.
<p>
If the standard error is a terminal,
all output written by the named
<i>utility</i>
to its standard error
will be redirected to the same file descriptor as the standard output.
</blockquote><h4><a name = "tag_001_014_1577">&nbsp;</a>OPTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1578">&nbsp;</a>OPERANDS</h4><blockquote>
The following operands are supported:
<dl compact>

<dt><i>utility</i><dd>The name of a
utility that is to be invoked.
If the
<i>utility</i>
operand names any of the special built-in utilities in
<xref href=sbi><a href="chap2.html#tag_001_014">
Special Built-in Utilities
</a></xref>,
the results are undefined.

<dt><i>argument</i><dd>
Any string to be supplied as an argument when invoking the
utility named by the
<i>utility</i>
operand.

</dl>
</blockquote><h4><a name = "tag_001_014_1579">&nbsp;</a>STDIN</h4><blockquote>
Not used.
</blockquote><h4><a name = "tag_001_014_1580">&nbsp;</a>INPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1581">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>nohup</i>:
<dl compact>

<dt><i>HOME</i><dd>Determine the pathname of the user's home directory:
if the output file
<b>nohup.out</b>
cannot be created in the current
directory, the
<i>nohup</i>
utility will use the directory named by
<i>HOME</i>
to create the file.

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.

<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments).

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
<dt><i>PATH</i><dd>Determine the search path
that will be used to locate the utility to be invoked.
See
the <b>XBD</b> specification, <a href="../xbd/envvar.html"><b>Environment Variables</b>&nbsp;</a> .

</dl>
</blockquote><h4><a name = "tag_001_014_1582">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
The
<i>nohup</i>
utility will take the
standard action for all signals
except that SIGHUP will be ignored.
</blockquote><h4><a name = "tag_001_014_1583">&nbsp;</a>STDOUT</h4><blockquote>
If the standard output is not a terminal, the standard output of
<i>nohup</i>
will be the standard output generated by the execution of the
<i>utility</i>
specified by the operands.
Otherwise, nothing will be written to the standard output.
</blockquote><h4><a name = "tag_001_014_1584">&nbsp;</a>STDERR</h4><blockquote>
If the standard output is a terminal,
a message will be written to the standard error,
indicating the name of the file to which the output is being appended.
The name of the file will be either
<b>nohup.out</b>
or
<b>$HOME/nohup.out</b>.
</blockquote><h4><a name = "tag_001_014_1585">&nbsp;</a>OUTPUT FILES</h4><blockquote>
If the standard output is a terminal,
all output written by the named
<i>utility</i>
to the standard output
and standard error is appended to the file
<b>nohup.out</b>,
which is created if it does not already exist.
</blockquote><h4><a name = "tag_001_014_1586">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1587">&nbsp;</a>EXIT STATUS</h4><blockquote>
The following exit values are returned:
<dl compact>

<dt>126<dd>The utility specified by
<i>utility</i>
was found but could not be invoked.

<dt>127<dd>An error occurred in the
<i>nohup</i>
utility or the utility specified by
<i>utility</i>
could not be found.

</dl>
<p>
Otherwise, the exit status of
<i>nohup</i>
will be that of the
utility specified by the
<i>utility</i>
operand.
</blockquote><h4><a name = "tag_001_014_1588">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_1589">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
The
<i><a href="command.html">command</a></i>,
<i><a href="env.html">env</a></i>,
<i><a href="nice.html">nice</a></i>,
<i>nohup</i>,
<i><a href="time.html">time</a></i>
and
<i><a href="xargs.html">xargs</a></i>
utilities have been specified to use
exit code 127 if an error occurs so that
applications can distinguish
&quot;failure to find a utility&quot; from &quot;invoked utility exited
with an error indication&quot;.
The value 127 was chosen because it is not commonly used for other meanings;
most utilities use small values for &quot;normal error conditions&quot; and
the values above 128 can be confused with termination due to receipt of a
signal.
The value 126
was chosen in a similar manner to indicate that the utility
could be found, but not invoked.
Some scripts produce meaningful error messages
differentiating the 126 and 127 cases.
The distinction between exit codes 126 and 127 is based
on KornShell practice that uses 127 when all attempts to
<i>exec</i>
the utility fail with
[ENOENT],
and uses 126 when any attempt to
<i>exec</i>
the utility fails for any other reason.
<br>
</blockquote><h4><a name = "tag_001_014_1590">&nbsp;</a>EXAMPLES</h4><blockquote>
It is frequently desirable to apply
<i>nohup</i>
to pipelines or lists of commands.
This can be done by placing pipelines
and command lists in a single file; this file can then be
invoked as a utility, and the
<i>nohup</i>
applies to everything in the file.
<p>
Alternatively, the following command can be used to apply
<i>nohup</i>
to a complex command:
<pre>
<code>
nohup sh -c '<i>complex-command-line</i>'
</code>
</pre>
</blockquote><h4><a name = "tag_001_014_1591">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_1592">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="sh.html">sh</a></i>,
the <b>XSH</b> specification description of
<i><a href="../xsh/signal.html">signal()</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
